// decode.h: Lightweight HTTP/2 HPACK Huffman decompressor.
// Written 5/30/14 by David Krauss. No rights reserved.

#ifndef SSTAR_LIGHTPRESS_HUFFMAN_DECODE_H
#define SSTAR_LIGHTPRESS_HUFFMAN_DECODE_H

struct hpack_huffman_bit_source; // User-defined; see decode.c.

// Decode a Huffman-encoded buffer.
extern int hpack_huffman_decode(
	struct hpack_huffman_bit_source * in_bits, // User-supplied stream object of user-defined type.
	uint8_t ** out, // Pointer to start of output buffer. On return, points to one past last output byte.
	size_t max ); // Size of output buffer.

enum hpack_huffman_decode_status { // Return codes from hpack_huffman_decode().
	hpack_huffman_decode_status_ok = 0, // Decoded everything fine.
	hpack_huffman_decode_status_overrun = -1, // Ran out of output space.
	hpack_huffman_decode_status_eos = -2 // Encountered a complete EOS symbol, which is illegal.
};

#endif
